from django.conf.urls import include, url
from django.contrib import admin
from app import views

urlpatterns = [
    url(r'^$',views.login), # user login
    url(r'^login/', views.login), # user login
    url(r'^index/', views.index), # home page
    url(r'^reg/', views.reg), # register
    url(r'^quit/', views.quit), # log out
    url(r'^good/', views.good), # merchandise page
    url(r'^goshopcar/', views.goshopcar), # go to shop car
    url(r'^shopcar/', views.shopcar), # shop car page
    url(r'^delfav/', views.delfav), # delete the merchandise in cart
    url(r'^rusult/', views.result), # create order successfully
    url(r'^myorder/', views.myorder), # order page of user
    url(r'^search/', views.search), # search page
    url(r'^adminlogin/', views.adminlogin), # admin login
    url(r'^product_list/', views.product_list), # show the all merchandise
    url(r'^product_delete/', views.product_delete), # delete the merchandise
    url(r'^product_edit/', views.product_edit), # edit the merchandise
    url(r'^product_add/', views.product_add), # add the merchandise
    url(r'^user_list/', views.user_list), # show the user list
    url(r'^user_edit/', views.user_edit), # edit the user
    url(r'^admin_list/', views.admin_list), # show the admin list
    url(r'^admin_del/', views.admin_del), # delete the admin
    url(r'^admin_edit/', views.admin_edit),# edit the admin
    url(r'^admin_add/', views.admin_add), # add the admin
    url(r'^order_list/', views.order_list), # show the order list
    url(r'^order_del/', views.order_del), # cancel the order
    # url(r'^order_fahuo/', views.order_fahuo),
    # url('app/', include('app.urls')),

]


from django.views.static import serve
from .settings import MEDIA_ROOT, DEBUG

if DEBUG: # get the return url and path into target function
    urlpatterns += url(r'^static/(?P<path>.*)/$', serve, {'document_root': MEDIA_ROOT}),
